#ifndef FRAME_SCENE_H_
#define FRAME_SCENE_H_

#include <GL/glew.h>
#include "util.h"
#include "draw.h"
#include "definitions.h"
#include "log.h"
#include "smartcontainer.h"

class CFrameBufferObject
{

private:
	
	GLuint m_fboObject;
	GLuint m_fboTexture;
	
public:
	
	CFrameBufferObject( int, int );
	~CFrameBufferObject();
	
	inline void BindFrameBufferObject()
	{
	
		glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_fboObject );
		
	}
	
	inline void BindTexture()
	{
		
		glBindTexture( GL_TEXTURE_2D, m_fboTexture );
		
	}
	
	inline void UnbindFrameBufferObject()
	{
		
		glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
		
	}
	
};

class CFrameScene
{
	
private:
	
	CSmartVector< CFrameBufferObject > m_pFrameBuffers;
	
public:
	
	CFrameScene();
	~CFrameScene();
	
	inline void BindFrameBufferObject( int i )
	{
		
		m_pFrameBuffers[i]->BindFrameBufferObject();
		
	}
	
	inline void UnbindFrameBufferObject()
	{
	
		glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
		
	}
	
	inline void BindFrameBufferTexture( int i )
	{
		
		m_pFrameBuffers[i]->BindTexture();
		
	}
	
	void Draw();

};

#endif
